/**
 * @author LKQ
 * @date 2021/12/25 15:47
 * @description 循环
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        solution.isPowerOfThree(45);
    }

    public boolean isPowerOfThree(int n) {
        if (n <=0 ) {
            return false;
        }
        while (n % 3 == 0) {
            n /= 3;
        }
        return n==1;

    }
}
